<!DESCRIPTION>The visitor must fill in either one of two fields, their name or email address. If they click in either box the other box's value is erased. Ensures that when the form is submitted only one field contains a value. Also contains validation that makes sure both fields are not empty. <!/DESCRIPTION>
<!CATEGORY>Forms<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL ONLY ONE FIELD:
1. Copy code into the HEAD section of document
2. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkFields() {
name = document.submitform.name.value;
email = document.submitform.email.value;
if ((name == "") && (email == "") ) {
alert("Please enter your name or your email address.");
return false;
}
else return true;
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Add code into BODY section of document -->